<style type="text/css">
.fan 
{
  border-top-width:1px;
  margin-top:10px;
  overflow:hidden;
  padding-top:10px;
}
.fan_title
{
    font-size: 13px;
    font-weight: bold;
    padding-left: 60px;
}
.profile_friends_icon
{
    position: absolute;   
}


</style>
<?php
$viewerId = $this->viewer->getIdentity();

$owner_id = $this->subject->getOwner()->getIdentity();
//echo $owner;
?>

<ul>
    <?php foreach ($this->fans as $fan): ?>

        <li class="fan">
            <?php
                  /* Created An OBJECT */
                  $user = Engine_Api::_()->getItem('user', $fan->follower_id);
                  // This COde is for Selecting User picture Afer Creating An Object Of User
                  echo $this->htmlLink($user->getHref(), $this->itemPhoto($user, 'thumb.icon'), array('class' => 'profile_friends_icon'));
            ?>
            <div class="fan_title">
            <!-- This COde is for Selecting User Title After Creating An Object Of User     -->
            <?php echo $this->htmlLink($user->getHref(), $user->getTitle()) ?>
            </div>  
          
<div style="float:right">

            <!-- This COde is for UNDO FRIEND in Tab menu -->
            <?php

                  $subject = Engine_Api::_()->core()->getSubject();

                  if($viewerId == $fan->follower_id && $fan->resource_id !== $owner_id)
                  {
                        echo $this->htmlLink(
                                            array(
                                                    'route' => 'fan_general',
                                                    'action' => 'remove',
                                                    'id' => $fan->fan_id,
                                                    'format' => 'smoothbox'
                                                  ),
                                                  $this->translate('Undo fan'),
                                                  array(
                                                        'class' => 'buttonlink icon_delete smoothbox',
                                                       ));
                    }
                   elseif($viewerId !== $fan->follower_id)   
                   {
                         echo $this->htmlLink(
                                            array(
                                                    'route' => 'fan_general',
                                                    'action' => 'index',
                                                    'id' => $fan->fan_id,
                                                    'format' => 'smoothbox'
                                                  ),
                                                  $this->translate(' Become a fan'),
                                                  array(
                                                        'class' => 'buttonlink icon_add smoothbox',
                                                       ));
                         }
                         else
                        {

                        }
            ?>
</div>
        </li>
    <?php endforeach; ?>
</ul>






























<!-- Here i was checking for SUBJECT id and Viewer ID -->
<?php
//$viewer = Engine_Api::_()->user()->getViewer();

$viewerId = $this->viewer->getIdentity();
//echo $viewerId;

$subjectId = $this->subject->getIdentity();
//echo $subjectId;
$owner = $this->subject->getOwner()->getIdentity();
//echo $owner;

      //if ($this->viewer->getIdentity() == $this->subject->getOwner()->getIdentity()){
     /* echo $this->htmlLink(
              array(
                    'route' => 'fan_general', 
                    'action' => 'remove', 
                    'id' =>$fan->fan_id, 
                   'format' => 'smoothbox'
                    ),
              
              
           $this->translate('Undo fan'),
           array(
               'class' => 'buttonlink icon_event_edit smoothbox',
               //'class' => 'smoothbox '
                 )); */
      //}    
      
?>

  <?php
  /* if ($this->viewer->getIdentity() == $this->subject->getOwner()->getIdentity()): ?>
                            <?php
                            echo $this->htmlLink(array('route' => 'matchresult_specific', 'action' => 'edit', 'matchresult_id' => $matchresult->getIdentity(), 'event_id' => $matchresult->event_id,), $this->translate('Edit Match Result'), array(
                            'class' => 'buttonlink icon_event_edit'
                            ))
         */   
  
  
  $viewerId = $this->viewer->getIdentity();    
$ownerId = $this->subject->getOwner()->getIdentity();


/////////////////////////////

/*    $subject = Engine_Api::_()->core()->getSubject();

    $isFan = Engine_Api::_()->fan()->isFan($subject);
    
    if(($isFan instanceof Fan_Model_Fan) && ( $viewerId == $ownerId )){
    echo $this->htmlLink(
                     array(
                    'route' => 'fan_general', 
                    'action' => 'remove', 
                    'id' =>$fan->fan_id, 
                   'format' => 'smoothbox'
                    ),
         
           $this->translate('Undo fan'),
           array(
               'class' => 'buttonlink icon_delete smoothbox',
               //'class' => 'smoothbox '
                 ));
    }
*/
/////////////////////
  ?>













<?php


/*

 if($viewerId == $fan->resource_id)
                  {
                        echo $this->htmlLink(
                                            array(
                                                    'route' => 'fan_general',
                                                    'action' => 'remove',
                                                    'id' => $fan->fan_id,
                                                    'format' => 'smoothbox'
                                                  ),
                                                  $this->translate('Undo fan'),
                                                  array(
                                                        'class' => 'buttonlink icon_delete smoothbox',
                                                       ));
                    }
                   elseif($viewerId !== $fan->resource_id && $viewerId == $fan->follower_id)
                   {
                        
                         echo $this->htmlLink(
                                            array(
                                                    'route' => 'fan_general',
                                                    'action' => 'index',
                                                    'id' => $user->getIdentity(),
                                                    'format' => 'smoothbox'
                                                  ),
                                                  $this->translate(' Become a fan'),
                                                  array(
                                                        'class' => 'buttonlink icon_add smoothbox',
                                                       ));
                         }

*/


/*

if($viewer_id == $fan->follower_id)   
                   {
                         echo $this->htmlLink(
                                             array(
                                                    'route' => 'fan_general',
                                                    'action' => 'remove',
                                                    'id' => $fan->fan_id,
                                                    'format' => 'smoothbox'
                                                  ),
                                                  $this->translate('Undo fan'),
                                                  array(
                                                        'class' => 'buttonlink icon_delete smoothbox',
                                                       ));
                    }
                    elseif ($viewer_id !== $fan->resource_id && $viewer_id !== $fan->follower_id) 
                        {
                     echo $this->htmlLink(
                                            array(
                                                    'route' => 'fan_general',
                                                    'action' => 'index',
                                                    'id' => $user->getIdentity(),
                                                    'format' => 'smoothbox'
                                                  ),
                                                  $this->translate(' Become a fan'),
                                                  array(
                                                        'class' => 'buttonlink icon_add smoothbox',
                                                       ));
                }


*/

?>


